package com.example.myapplication;

import android.os.Bundle;
import android.view.View;
import android.widget.MediaController;
import android.widget.VideoView;
import androidx.appcompat.app.AppCompatActivity;

import java.io.File;

public class VideoViewActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video_view);

        VideoView videoView = findViewById(R.id.videoView);

        //工具条
        MediaController mediaController = new MediaController(this);
        //上一曲下一曲监听
        mediaController.setPrevNextListeners(this,this);
        videoView.setMediaController(mediaController);

        videoView.setVideoPath(new File(getExternalFilesDir(""), "a.mp4").getAbsolutePath());
        videoView.start();

    }

    @Override
    public void onClick(View v) {

    }

}